package com.bxait;

import com.bxait.utils.ESClientSingle;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.client.indices.GetIndexResponse;
import java.io.IOException;

/**
 * @author Chen
 * @description: 查询es索引
 * @ClassName ESTest_Client
 * @create 2023-04-08 16:16
 * @Version 1.0
 */
public class ESTest_Index_Search {

    public static void main(String[] args) throws IOException {
        // 创建ES的客户端
        RestHighLevelClient client = ESClientSingle.getInstant();
        // 查询索引
        GetIndexRequest request = new GetIndexRequest("user2");
        GetIndexResponse getIndexResponse
                               = client.indices().get(request, RequestOptions.DEFAULT);
        System.out.println(getIndexResponse.getAliases());
        // 索引的结果
        System.out.println(getIndexResponse.getMappings());
        // 索引的配置
        System.out.println(getIndexResponse.getSettings());
        // 关闭es客户端
        client.close();
    }

}
